home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_transfig.idb / usr / freeware / bin / fig2ps2tex.sh.z / fig2ps2tex.sh
Linux/UNIX/POSIX Shell Script  |  2002-04-08  |  654b  |  25 lines

  1. #!/bin/sh -f
  2. #
  3. # Fig2ps2tex.sh - generate a TeX file for including a PostScript file
  4. #         involves calculating the bounding box from fig2ps output
  5. # version for systems without csh -- uses bc and awk
  6. #
  7. bbox=`grep "^%%BoundingBox:" $1`
  8.  
  9. bbox2=`echo $bbox | awk '{print $2}'`
  10. bbox3=`echo $bbox | awk '{print $3}'`
  11. bbox4=`echo $bbox | awk '{print $4}'`
  12. bbox5=`echo $bbox | awk '{print $5}'`
  13.  
  14. xsp=`echo "scale=3; ( $bbox4 - $bbox2 ) / 72" | bc`
  15. ysp=`echo "scale=3; ( $bbox5 - $bbox3 ) / 72" | bc`
  16.  
  17. echo "\makebox[${xsp}in][l]{"
  18. echo "  \vbox to ${ysp}in{"
  19. echo "    \vfill"
  20. echo "    \special{psfile=$1}"
  21. echo "  }"
  22. echo "  \vspace{-\baselineskip}"
  23. echo "}"
  24.  
  25.